package library.doMain;


abstract class Door{
    abstract void open();
    abstract void close();
}

interface IAlarmable {
    void alarm();//抽象方法：报警功能
}

interface IPlayingMusic{
    void playMusic();
}

class SafeDoor extends Door implements IAlarmable, IPlayingMusic {
    @Override
    public void open() {
        System.out.println("安全门打开");
    }

    @Override
    public void close() {
        System.out.println("安全门关闭");
    }

    @Override
    public void alarm() {
        System.out.println("安全门报警");
    }

    @Override
    public void playMusic() {
        System.out.println("安全门播放音乐");
    }
}

class KitchenAlarm implements IAlarmable{
    @Override
    public void alarm() {
        System.out.println("厨房防烟报警");
    }
}

public class TestDoor {
    public static void main(String[] args) {
        SafeDoor s = new SafeDoor();
        s.open();
        s.alarm();
        s.playMusic();
        s.close();

        KitchenAlarm k = new KitchenAlarm();
        k.alarm();
    }
}
